/**
 * <copyright>
 *
 * Copyright (c) 2011 Zeligsoft (2009) Limited
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors: 
 *   Zeligsoft (2009) Limited - Initial API and implementation
 *
 * </copyright>
 *
 */
package org.omg.deployment.impl;

import java.util.Collection;

import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.omg.deployment.DeploymentPackage;
import org.omg.deployment.ExternalReferenceEndpoint;
import org.omg.xmi.impl.XMIImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>External Reference Endpoint</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.omg.deployment.impl.ExternalReferenceEndpointImpl#getLocation <em>Location</em>}</li>
 *   <li>{@link org.omg.deployment.impl.ExternalReferenceEndpointImpl#getProvider <em>Provider</em>}</li>
 *   <li>{@link org.omg.deployment.impl.ExternalReferenceEndpointImpl#getPortName <em>Port Name</em>}</li>
 *   <li>{@link org.omg.deployment.impl.ExternalReferenceEndpointImpl#getSupportedType <em>Supported Type</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ExternalReferenceEndpointImpl extends XMIImpl implements
		ExternalReferenceEndpoint {
	/**
	 * The default value of the '{@link #getLocation() <em>Location</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLocation()
	 * @generated
	 * @ordered
	 */
	protected static final String LOCATION_EDEFAULT = null;

	/**
	 * The default value of the '{@link #getProvider() <em>Provider</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getProvider()
	 * @generated
	 * @ordered
	 */
	protected static final String PROVIDER_EDEFAULT = null;

	/**
	 * The default value of the '{@link #getPortName() <em>Port Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPortName()
	 * @generated
	 * @ordered
	 */
	protected static final String PORT_NAME_EDEFAULT = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ExternalReferenceEndpointImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return DeploymentPackage.eINSTANCE.getExternalReferenceEndpoint();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getLocation() {
		return (String) getGroup()
				.get(DeploymentPackage.eINSTANCE
						.getExternalReferenceEndpoint_Location(),
						true);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLocation(String newLocation) {
		((FeatureMap.Internal) getGroup()).set(DeploymentPackage.eINSTANCE
				.getExternalReferenceEndpoint_Location(), newLocation);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getProvider() {
		return (String) getGroup()
				.get(DeploymentPackage.eINSTANCE
						.getExternalReferenceEndpoint_Provider(),
						true);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setProvider(String newProvider) {
		((FeatureMap.Internal) getGroup()).set(DeploymentPackage.eINSTANCE
				.getExternalReferenceEndpoint_Provider(), newProvider);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getPortName() {
		return (String) getGroup()
				.get(DeploymentPackage.eINSTANCE
						.getExternalReferenceEndpoint_PortName(),
						true);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPortName(String newPortName) {
		((FeatureMap.Internal) getGroup()).set(DeploymentPackage.eINSTANCE
				.getExternalReferenceEndpoint_PortName(), newPortName);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<String> getSupportedType() {
		return getGroup().list(
				DeploymentPackage.eINSTANCE
						.getExternalReferenceEndpoint_SupportedType());
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
		case DeploymentPackage.EXTERNAL_REFERENCE_ENDPOINT__LOCATION:
			return getLocation();
		case DeploymentPackage.EXTERNAL_REFERENCE_ENDPOINT__PROVIDER:
			return getProvider();
		case DeploymentPackage.EXTERNAL_REFERENCE_ENDPOINT__PORT_NAME:
			return getPortName();
		case DeploymentPackage.EXTERNAL_REFERENCE_ENDPOINT__SUPPORTED_TYPE:
			return getSupportedType();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
		case DeploymentPackage.EXTERNAL_REFERENCE_ENDPOINT__LOCATION:
			setLocation((String) newValue);
			return;
		case DeploymentPackage.EXTERNAL_REFERENCE_ENDPOINT__PROVIDER:
			setProvider((String) newValue);
			return;
		case DeploymentPackage.EXTERNAL_REFERENCE_ENDPOINT__PORT_NAME:
			setPortName((String) newValue);
			return;
		case DeploymentPackage.EXTERNAL_REFERENCE_ENDPOINT__SUPPORTED_TYPE:
			getSupportedType().clear();
			getSupportedType().addAll((Collection<? extends String>) newValue);
			return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
		case DeploymentPackage.EXTERNAL_REFERENCE_ENDPOINT__LOCATION:
			setLocation(LOCATION_EDEFAULT);
			return;
		case DeploymentPackage.EXTERNAL_REFERENCE_ENDPOINT__PROVIDER:
			setProvider(PROVIDER_EDEFAULT);
			return;
		case DeploymentPackage.EXTERNAL_REFERENCE_ENDPOINT__PORT_NAME:
			setPortName(PORT_NAME_EDEFAULT);
			return;
		case DeploymentPackage.EXTERNAL_REFERENCE_ENDPOINT__SUPPORTED_TYPE:
			getSupportedType().clear();
			return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
		case DeploymentPackage.EXTERNAL_REFERENCE_ENDPOINT__LOCATION:
			return LOCATION_EDEFAULT == null ? getLocation() != null
					: !LOCATION_EDEFAULT.equals(getLocation());
		case DeploymentPackage.EXTERNAL_REFERENCE_ENDPOINT__PROVIDER:
			return PROVIDER_EDEFAULT == null ? getProvider() != null
					: !PROVIDER_EDEFAULT.equals(getProvider());
		case DeploymentPackage.EXTERNAL_REFERENCE_ENDPOINT__PORT_NAME:
			return PORT_NAME_EDEFAULT == null ? getPortName() != null
					: !PORT_NAME_EDEFAULT.equals(getPortName());
		case DeploymentPackage.EXTERNAL_REFERENCE_ENDPOINT__SUPPORTED_TYPE:
			return !getSupportedType().isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //ExternalReferenceEndpointImpl
